package cn.acheng1314.springboot2.service.impl

import cn.acheng1314.springboot2.dto.HousePropertyDTO
import cn.acheng1314.springboot2.entity.HouseProperty
import cn.acheng1314.springboot2.mapper.HousePropertyMapper
import cn.acheng1314.springboot2.service.IHousePropertyService
import com.alibaba.fastjson.JSONObject
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import org.springframework.stereotype.Service

/**
 * 房源服务
 * @author cheng
 * @date 2019年12月15日 23:51:40
 */
@Service
open class HousePropertyServiceImpl : ServiceImpl<HousePropertyMapper, HouseProperty>(), IHousePropertyService {

    /**
     * 保存房源信息，并返回结果JsonOb
     */
    override fun saveHouseProperty(dto: HousePropertyDTO): HouseProperty = JSONObject.parseObject(JSONObject.toJSONString(dto), HouseProperty::class.java).run {
        save(this)
        return@saveHouseProperty this
    }


}